package com.android.calculator.factory;

import com.android.calculator.operate.OperateAdd;
import com.android.calculator.operate.OperateBase;
import com.android.calculator.operate.OperateDivide;
import com.android.calculator.operate.OperateMultipli;
import com.android.calculator.operate.OperateSubtract;

/**
 * Created by Aaron on 2017/9/13.
 */

public class OperateFactory {

    /**
     * @param symbol 运算符号
     * @return
     */
    public static OperateBase buildOperateor(String symbol) {
        OperateBase operate = null;

        switch (symbol) {
            case "+":
                // 加法
                operate = new OperateAdd();
                break;
            case "-":
                operate = new OperateSubtract();
                break;
            case "X":
                operate = new OperateMultipli();
                break;
            case "÷":
                operate = new OperateDivide();
                break;
        }
        return operate;
    }
}
